<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">

    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <meta name="description" content="Utility for converting cURL commands to code">
    <meta name="author" content="Nick Carneiro">

    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-title" content="curlconverter">
    <meta name="format-detection" content="telephone=no">

    <meta name="mobile-web-app-capable" content="yes">

    <link rel="preload" href="/tree-sitter.wasm" type="application/wasm" as="fetch" crossorigin>
    <link rel="preload" href="/tree-sitter-bash.wasm" type="application/wasm" as="fetch" crossorigin>

    <link rel="icon" href="/favicon.ico" type="image/x-icon">
    <link rel="apple-touch-icon" href="/apple-touch-icon.png">
    <link rel="manifest" href="/site.webmanifest">

    <link href="/main.css" rel="stylesheet">

    <title>Convert curl commands to code</title>
  </head>
  <body>

  <div class="container-md py-2">
    <div class="row">
      <div class="col-8 col-sm-10 col-md-11">
        <h3 class="text-muted d-none d-md-block">Convert <a href="https://curl.se/docs/manual.html">curl</a> commands to Python, JavaScript and more</h3>
        <h3 class="text-muted d-block d-md-none">Convert <a href="https://curl.se/docs/manual.html">curl</a> to Python, JavaScript and more</h3>
      </div>
    </div>
  </div>
  <a class="github-fork-ribbon right-top" href="https://github.com/curlconverter/curlconverter" data-ribbon="Fork me on GitHub" title="Fork me on GitHub">Fork me on GitHub</a>

  <div class="container-xl pb-4">
    <div class="row pb-3">
      <div class="col-12 col-sm-4 order-1">
        <h2 class="mb-sm-0">curl command</h2>
      </div>
      <div class="col-12 col-md-7 col-xl-8 order-3 order-md-2 pt-md-3 text-end">
        <small class="examples align-top">
          Examples:
          <a id="get-example" href="#">GET</a>
          -
          <a id="post-example" href="#">POST</a>
          -
          <a id="json-example" href="#">JSON</a>
          <span class="d-none d-sm-inline">
            -
            <a id="basic-auth-example" href="#">Basic Auth</a>
          </span>
          -
          <a id="files-example" href="#">Files</a>
          -
          <a id="form-example" href="#">Form</a>
        </small>
      </div>
      <div class="col-12 order-2 order-md-3 pb-md-3">
        <textarea id="curl-code" class="form-control" placeholder="curl example.com" rows=6 spellcheck="false" autocorrect="off" autocapitalize="none" disabled></textarea>
      </div>
    </div>

    <div class="row pb-1 pb-lg-0" role="navigation">
      <div class="col-sm-auto d-none d-sm-block d-xl-none py-1">
        <h2>Language:</h2>
      </div>
      <div class="col col-sm-auto d-xl-none px-sm-0">
        <select class="form-select form-select-lg" id="language-select">
          <option value="ansible">Ansible</option>
          <option value="csharp">C#</option>
          <option value="clojure">Clojure</option>
          <option value="coldfusion">ColdFusion</option>
          <option value="dart">Dart</option>
          <option value="elixir">Elixir</option>
          <option value="go">Go</option>
          <option value="har">HAR</option>
          <option value="http">HTTP</option>
          <option value="httpie">HTTPie</option>
          <option value="java">Java + HttpClient</option>
          <option value="java-httpurlconnection">Java + HttpURLConnection</option>
          <option value="java-jsoup">Java + jsoup</option>
          <option value="java-okhttp">Java + OkHttp</option>
          <option value="javascript">JavaScript + fetch</option>
          <option value="javascript-jquery">JavaScript + jQuery</option>
          <option value="javascript-xhr">JavaScript + XHR</option>
          <option value="json">JSON</option>
          <option value="kotlin">Kotlin</option>
          <option value="matlab">MATLAB</option>
          <option value="node-axios">Node.js + Axios</option>
          <option value="node-got">Node.js + Got</option>
          <option value="node-ky">Node.js + Ky</option>
          <option value="node-fetch">Node.js + node-fetch</option>
          <option value="node-request">Node.js + request</option>
          <option value="node-superagent">Node.js + SuperAgent</option>
          <option value="node-http">Node + http</option>
          <option value="objectivec">Objective-C</option>
          <option value="ocaml">OCaml</option>
          <option value="php">PHP + cURL</option>
          <option value="php-guzzle">PHP + Guzzle</option>
          <option value="powershell-restmethod">PowerShell + Invoke-RestMethod</option>
          <option value="powershell-webrequest">PowerShell + Invoke-WebRequest</option>
          <option value="python" selected>Python + Requests</option>
          <option value="python-httpclient">Python + http.client</option>
          <option value="r">R</option>
          <option value="ruby">Ruby</option>
          <option value="rust">Rust</option>
          <option value="swift">Swift</option>
          <option value="wget">Wget</option>
        </select>
      </div>

      <ul class="nav nav-tabs d-none d-xl-flex px-3" id="language-navbar">
        <li class="nav-item">
          <a class="nav-link" href="/ansible/">Ansible</a>
        </li>
        <li class="nav-item">
          <a class="nav-link nav-link-outbound" href="https://everything.curl.dev/libcurl/libcurl">
            <!--! Font Awesome Pro 6.1.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc. -->
            C <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M256 64C256 46.33 270.3 32 288 32H415.1C415.1 32 415.1 32 415.1 32C420.3 32 424.5 32.86 428.2 34.43C431.1 35.98 435.5 38.27 438.6 41.3C438.6 41.35 438.6 41.4 438.7 41.44C444.9 47.66 447.1 55.78 448 63.9C448 63.94 448 63.97 448 64V192C448 209.7 433.7 224 416 224C398.3 224 384 209.7 384 192V141.3L214.6 310.6C202.1 323.1 181.9 323.1 169.4 310.6C156.9 298.1 156.9 277.9 169.4 265.4L338.7 96H288C270.3 96 256 81.67 256 64V64zM0 128C0 92.65 28.65 64 64 64H160C177.7 64 192 78.33 192 96C192 113.7 177.7 128 160 128H64V416H352V320C352 302.3 366.3 288 384 288C401.7 288 416 302.3 416 320V416C416 451.3 387.3 480 352 480H64C28.65 480 0 451.3 0 416V128z"/></svg>
          </a>
        </li>
        <li class="nav-item">
          <a class="nav-link" href="/csharp/">C#</a>
        </li>
        <li class="nav-item">
          <a class="nav-link" href="/coldfusion/" title="ColdFusion Markup Language">ColdFusion</a>
        </li>
        <li class="nav-item">
          <a class="nav-link" href="/clojure/">Clojure</a>
        </li>
        <li class="nav-item">
          <a class="nav-link" href="/dart/">Dart</a>
        </li>
        <li class="nav-item">
          <a class="nav-link" href="/elixir/">Elixir</a>
        </li>
        <li class="nav-item">
          <a class="nav-link" href="/go/">Go</a>
        </li>
        <li class="nav-item">
          <a class="nav-link" href="/har/">HAR</a>
        </li>
        <li class="nav-item">
          <a class="nav-link" href="/http/">HTTP</a>
        </li>
        <li class="nav-item">
          <a class="nav-link" href="/httpie/">HTTPie</a>
        </li>
        <li class="nav-item dropdown">
          <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-expanded="false">Java</a>
          <ul class="dropdown-menu">
            <li><a class="dropdown-item" href="/java/">HttpClient</a></li>
            <li><a class="dropdown-item" href="/java-httpurlconnection/">HttpURLConnection</a></li>
            <li><a class="dropdown-item" href="/java-jsoup/">jsoup</a></li>
            <li><a class="dropdown-item" href="/java-okhttp/">OkHttp</a></li>
          </ul>
        </li>
        <li class="nav-item dropdown">
          <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-expanded="false">JavaScript</a>
          <ul class="dropdown-menu">
            <li><a class="dropdown-item" href="/javascript/">fetch</a></li>
            <li><a class="dropdown-item" href="/javascript-jquery/">jQuery</a></li>
            <li><a class="dropdown-item" href="/javascript-xhr/">XHR</a></li>
          </ul>
        </li>
        <li class="nav-item">
          <a class="nav-link" href="/json/">JSON</a>
        </li>
        <li class="nav-item">
          <a class="nav-link" href="/kotlin/">Kotlin</a>
        </li>
        <li class="nav-item">
          <a class="nav-link" href="/matlab/">MATLAB</a>
        </li>
        <li class="nav-item dropdown">
          <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-expanded="false">Node.js</a>
          <ul class="dropdown-menu">
            <li><a class="dropdown-item" href="/node-axios/">Axios</a></li>
            <li><a class="dropdown-item" href="/node-got/">Got</a></li>
            <li><a class="dropdown-item" href="/node-ky/">Ky</a></li>
            <li><a class="dropdown-item" href="/node-fetch/">node-fetch</a></li>
            <li><a class="dropdown-item" href="/node-request/">request</a></li>
            <li><a class="dropdown-item" href="/node-superagent/">SuperAgent</a></li>
            <li><a class="dropdown-item" href="/node-http/">http</a></li>
          </ul>
        </li>
        <li class="nav-item">
          <a class="nav-link" href="/objectivec/">Objective-C</a>
        </li>
        <li class="nav-item">
          <a class="nav-link" href="/ocaml/">OCaml</a>
        </li>
        <li class="nav-item dropdown">
          <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-expanded="false">PHP</a>
          <ul class="dropdown-menu">
            <li><a class="dropdown-item" href="/php/">cURL</a></li>
            <li><a class="dropdown-item" href="/php-guzzle/">Guzzle</a></li>
          </ul>
        </li>
        <li class="nav-item dropdown">
          <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-expanded="false">PowerShell</a>
          <ul class="dropdown-menu">
            <li><a class="dropdown-item" href="/powershell-restmethod/">Invoke-RestMethod</a></li>
            <li><a class="dropdown-item" href="/powershell-webrequest/">Invoke-WebRequest</a></li>
          </ul>
        </li>
        <li class="nav-item dropdown">
          <a class="nav-link dropdown-toggle active" data-bs-toggle="dropdown" href="#" role="button" aria-expanded="false">Python</a>
          <ul class="dropdown-menu">
            <li><a class="dropdown-item active" href="/python/">Requests</a></li>
            <li><a class="dropdown-item" href="/python-httpclient/">http.client</a></li>
          </ul>
        </li>
        <li class="nav-item">
          <a class="nav-link" href="/r/">R</a>
        </li>
        <li class="nav-item">
          <a class="nav-link" href="/ruby/">Ruby</a>
        </li>
        <li class="nav-item">
          <a class="nav-link" href="/rust/">Rust</a>
        </li>
        <li class="nav-item">
          <a class="nav-link" href="/swift/">Swift</a>
        </li>
        <li class="nav-item">
          <a class="nav-link" href="/wget/">Wget</a>
        </li>
      </ul>
    </div>

    <div class="row">
      <div class="col">
        <pre><code id="generated-code">import requests

response = requests.get('http://example.com')</code></pre>
      </div>
    </div>
    <div class="row">
      <div id="copy-to-clipboard" class="text-end"><a href="#">Copy to clipboard</a></div>
      <div style="display: none;" id="issue-promo">If your syntax is correct, please open a
        <a href="https://github.com/curlconverter/curlconverter/issues/new" target="_blank">new issue on GitHub</a>
      </div>
    </div>
    <div class="row">
      <div id="warnings-container" class="col pt-3" style="display: none;">
        <pre><code id="warnings" style="display: block;"></code></pre>
      </div>
    </div>

  </div>
  <div class="container-md pb-4">
    <div class="row border-top py-4">
      <div class="col-lg-4" id="chrome">
        <h3>curl from Google Chrome</h3>
        <ol>
          <li>Open the <a href="https://developer.chrome.com/docs/devtools/network/">Network</a> tab in the <a href="https://developer.chrome.com/docs/devtools/overview/">DevTools</a></li>
          <li>Right click (or Ctrl-click) a request</li>
          <li>Click "Copy" &#8594; <span class="not-windows">"Copy as cURL"</span><span class="windows d-none">"Copy as cURL (<b>bash</b>)"</span></li>
          <li>Paste it in the <b>curl command</b> box above</li>
        </ol>
        <p>
          This also works in <a class="to-safari" href="#">Safari</a> and <a class="to-firefox" href="#">Firefox</a>.
        </p>
        <p class="d-none d-lg-block pt-3">
          <b>Warning</b>: the copied command may contain cookies or other sensitive data. Be careful if you're sharing the command with other people, sending someone your cookie for a website is like sending them your password.
        </p>
      </div>
      <div class="col-lg-4 d-none" id="safari">
        <h3>curl from Safari</h3>
        <ol>
          <li>Open the <a href="https://support.apple.com/en-us/guide/safari-developer/dev1f3525e58/mac">Network</a> tab in the <a href="https://support.apple.com/en-us/guide/safari-developer/dev073038698/mac">Developer Tools</a></li>
          <li>Right click (or Ctrl-click or two-finger click) a request</li>
          <li>Click "Copy as cURL" in the dropdown menu</li>
          <li>Paste it in the <b>curl command</b> box above</li>
        </ol>
        <p>
          This also works in <a class="to-chrome" href="#">Chrome</a> and <a class="to-firefox" href="#">Firefox</a>.
        </p>
        <p class="d-none d-lg-block pt-3">
          <b>Warning</b>: the copied command may contain cookies or other sensitive data. Be careful if you're sharing the command with other people, sending someone your cookie for a website is like sending them your password.
        </p>
      </div>
      <div class="col-lg-4 d-none" id="firefox">
        <h3>curl from Firefox</h3>
        <ol>
          <li>Open the <a href="https://developer.mozilla.org/en-US/docs/Tools/Network_Monitor">Network Monitor</a> tab in the <a href="https://developer.mozilla.org/en-US/docs/Tools">Developer Tools</a></li>
          <li>Right click (or Ctrl-click) a request</li>
          <li>Click "Copy" &#8594; "Copy as cURL"</li>
          <li>Paste it in the <b>curl command</b> box above</li>
        </ol>
        <p>
          This also works in <a class="to-chrome" href="#">Chrome</a> and <a class="to-safari" href="#">Safari</a>.
        </p>
        <p class="d-none d-xl-block pt-3">
          <b>Warning</b>: the copied command may contain cookies or other sensitive data. Be careful if you're sharing the command with other people, sending someone your cookie for a website is like sending them your password.
        </p>
      </div>
      <div class="col-lg-8">
        <picture id="screenshot">
          <img width="648" height="354" src=""></img>
        </picture>
      </div>
    </div>

    <div class="row border-top pt-4">
      <div class="col-sm-12 col-md-4">
        <h3>Privacy</h3>
        <p>
          We do <b>not</b> transmit or record the curl commands you enter or what they're converted to.
          This is a static website (hosted on <a href="https://pages.github.com">GitHub Pages</a>) and the conversion happens <a href="https://github.com/curlconverter/curltorequests/blob/master/index.js">entirely in your browser</a> using JavaScript.
        </p>
        <p class="pt-lg-2">
          There is also <a href="https://marketplace.visualstudio.com/items?itemName=curlconverter.curlconverter">a VS Code extension</a> and a command line tool you can install from <a href="https://www.npmjs.com/package/curlconverter">npm</a> with
        </p>
        <p>
          <code>npm install -g curlconverter</code>
        </p>
      </div>
      <div class="col-sm-6 col-md-4">
        <h3>Similar Tools</h3>
        <ul>
          <li><a href="https://www.postman.com/">Postman</a>, <a href="https://insomnia.rest/">Insomnia</a> and <a href="https://paw.cloud/">Paw</a></li>
          <li><a href="https://mholt.github.io/curl-to-go/">curl-to-Go</a>, <a href="https://incarnate.github.io/curl-to-php/">-to-PHP</a>, <a href="https://jhawthorn.github.io/curl-to-ruby/">-to-ruby</a></li>
          <li><a href="https://ryan.govost.es/http-translator/">http-translator</a> (to Python and JS)</li>
          <li>curl's <a href="https://everything.curl.dev/libcurl/libcurl">--libcurl</a> (to C)</li>
          <li><a href="https://github.com/spulec/uncurl">uncurl</a> (to Python)</li>
          <li><a href="https://github.com/hrbrmstr/curlconverter">hrbrmstr/curlconverter</a> (to R)</li>
          <li><a href="https://github.com/xuchunyang/curl-to-elisp">curl-to-elisp</a></li>
          <li><a href="https://mattcg.github.io/har-to-curl/">HAR-to-curl</a></li>
          <li><a href="https://github.com/ofw/curlify">curlify</a> (Python to curl)</li>
          <li><a href="https://www.swag.uwaterloo.ca/bash2py/index.html">Bash2Py</a></li>
        </ul>
      </div>
      <div class="col-sm-6 col-md-4">
        <div class="row">
          <h3>Support Us</h3>
          <div class="well larger-text pb-3 pb-sm-4">
            <p>GitHub is matching all contributions to this project on <a href="https://github.com/sponsors/NickCarneiro">GitHub Sponsors</a>.</p>
            <a class="btn btn-primary" href="https://github.com/sponsors/NickCarneiro">
              Contribute Now
            </a>
          </div>
          <h3>Found a problem?</h3>
          <div>
            Please report bugs
            <a href="https://github.com/curlconverter/curlconverter/issues/new">on GitHub</a>.
          </div>
        </div>
      </div>
    </div>
  </div>

  <script src="/main.js"></script>
  </body>
</html>
